/*
 * 年度薪酬总额增长率
 */
var url = '', jsonData = '';
$(function(){
	loadData();
});

function loadData(){
	loadTopCSS();
	/**
	 * 年度薪酬总额增长率
	 */
	loadAnnualGrowthRateOfTotalCompensation();
	 
}

function loadTopCSS() {
	$("#li9").addClass("navdown");
}

function loadAnnualGrowthRateOfTotalCompensation() {
	url = ctx + '/employeeRRController/salaryGrowt';
	
	var departmentId = $('#departmentId').val();
	var startTime = $('#startAnnualGrowthRateOfTotalCompensation').val();
	var endTime = $('#endAnnualGrowthRateOfTotalCompensation').val();
	
	
      if (startTime.length==0||endTime.length==0||startTime==endTime) {
		
		var date = new Date();
		var year = date.getFullYear();
		
		
		var startYear = year-2;
		
		startTime = startYear;
		endTime = year;
		
      }
	
	$('#startAnnualGrowthRateOfTotalCompensation').val(startTime);
	$('#endAnnualGrowthRateOfTotalCompensation').val(endTime);
	
	
	jsonData = {departmentId:departmentId,startTime:startTime,endTime:endTime};
	var returnData= commonAjax();
	//var returnData= commonAjax();
	
	initStackBarChart(returnData.title,returnData.data,returnData.dates,returnData.name1,returnData.name2,document.getElementById('annualGrowthRateOfTotalCompensationMain'));
	
}

function commonAjax(){
	var result = '';
	$.ajax({
		type: 'GET',
		data: jsonData,
	    url: url,
	    async: false,
	    dataType:"json",
	    success: function(data){
	    	result = data;
	    },
	    error: function(){
	    }
	});
	return result;
}
/**
 *  ！！！！！！！！！！！异步请求！！！！！！！！！！！！！
 */
/*function commonAjax(fun, dataType){
	$.ajax({
		type: 'POST',
		data: jsonData,
	    url: url,
	    dataType: dataType,
	    success: function(data){
	    	fun(data);
	    },
	    error: function(){
	    }
	});
}*/